package com.singzi.leetcode.jianzhiOffer;

public class T00101 {
}
class Solution00101 {
    public int fib(int n) {
        if(n == 0) return 0;
        if(n == 1) return 1;
        int []fibs = new int[3];
        fibs[1] = 1;
        for (int i = 2; i < n; i++) {
            fibs[i] = fibs[0] + fibs[1];
            fibs[0] = fibs[1];
            fibs[1] = fibs[2];

        }
        return fibs[2];

    }
}